import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MemberInfoConfigVO, MemberInfoConfigForm, MemberInfoConfigQuery } from '@/api/member/memberInfoConfig/types';

/**
 * 查询会员设置列表
 * @param query
 * @returns {*}
 */

export const listMemberInfoConfig = (query?: MemberInfoConfigQuery): AxiosPromise<MemberInfoConfigVO[]> => {
  return request({
    url: '/member/memberInfoConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询会员设置详细
 * @param infoConfigId
 */
export const getMemberInfoConfig = (infoConfigId: string | number): AxiosPromise<MemberInfoConfigVO> => {
  return request({
    url: '/member/memberInfoConfig/' + infoConfigId,
    method: 'get'
  });
};

/**
 * 新增会员设置
 * @param data
 */
export const addMemberInfoConfig = (data: MemberInfoConfigForm) => {
  return request({
    url: '/member/memberInfoConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改会员设置
 * @param data
 */
export const updateMemberInfoConfig = (data: MemberInfoConfigForm) => {
  return request({
    url: '/member/memberInfoConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除会员设置
 * @param infoConfigId
 */
export const delMemberInfoConfig = (infoConfigId: string | number | Array<string | number>) => {
  return request({
    url: '/member/memberInfoConfig/' + infoConfigId,
    method: 'delete'
  });
};
